
var vuemodel =  new Vue({
    el:'section',
    data:{
        qr:'',
        jobInfo:{},
        firmInfo:{}
    }
});


function getParam(paramName) {
    paramValue = "", isFound = !1;
    if (this.location.search.indexOf("?") == 0 && this.location.search.indexOf("=") > 1) {
        arrSource = unescape(this.location.search).substring(1, this.location.search.length).split("&"), i = 0;
        while (i < arrSource.length && !isFound) arrSource[i].indexOf("=") > 0 && arrSource[i].split("=")[0].toLowerCase() == paramName.toLowerCase() && (paramValue = arrSource[i].split("=")[1], isFound = !0), i++
    }
    return paramValue == "" && (paramValue = null), paramValue
}

var page_key = getParam("key");

function search(){
    window.open('../search/index.html?key='+$('#search_val').val());
}


$.get('http://lepinapi.91qulepin.com/AppView/JobInfo/190/AF131AB/',{
    jobKey: page_key
},function(data){

    data['firmInfo']['Logo'] = 'http://lepinapi.91qulepin.com' + data['firmInfo']['Logo'].replace(/[\r\n]/g, "").replace(/[ ]/g, "").replace('["', '').replace('"]', '');

    if(data['jobInfo']['img1']){
        data['jobInfo']['img1'] = 'http://lepinapi.91qulepin.com' + data['jobInfo']['img1'].replace(/[\r\n]/g, "").replace(/[ ]/g, "").replace('["', '').replace('"]', '');
    }

    if(data['jobInfo']['img2']){
        data['jobInfo']['img2'] = 'http://lepinapi.91qulepin.com' + data['jobInfo']['img2'].replace(/[\r\n]/g, "").replace(/[ ]/g, "").replace('["', '').replace('"]', '');
    }

    if(data['jobInfo']['img3']){
        data['jobInfo']['img3'] = 'http://lepinapi.91qulepin.com' + data['jobInfo']['img3'].replace(/[\r\n]/g, "").replace(/[ ]/g, "").replace('["', '').replace('"]', '');
    }

    vuemodel.jobInfo = data['jobInfo'];
    vuemodel.firmInfo = data['firmInfo'];

});


$('#app').css({
    height:window.innerHeight - 100
});

$.post(
    'http://lepinapi.91qulepin.com/home/wx_sdk_sh1',
{
    page:'pages/jobInfo/jobInfo',
    key:page_key
},function(data){
    vuemodel.qr = 'http://lepinapi.91qulepin.com/' + data.qr;
});

$('nav ul li').each(function () {
    switch ($(this).attr('data-type')) {
        case 'search':
            $(this).click(function () {
                window.open('../search/index.html');
            });
            break;
        case 'r_job':
            $(this).click(function () {
                window.open('../r_job/index.html');
            });
            break;
        case 'info':
            $(this).click(function () {
                window.open('../news/index.html');
            });
            break;
        case 'my':
            $(this).click(function () {
                window.open('../my/index.html');
            });
            break;
        case 'home':
            $(this).click(function () {
                window.open('../main/index.html');
            });
            break;
    }
});